import Main from './views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: resolve => { require(['./views/login.vue'], resolve); }
};

export const page404 = {
    path: '/*',
    name: 'error_404',
    meta: {
        title: '404-页面不存在'
    },
    component: resolve => { require(['./views/error_page/404.vue'], resolve); }
};

export const page401 = {
    path: '/401',
    meta: {
        title: '401-权限不足'
    },
    name: 'error_401',
    component: resolve => { require(['./views/error_page/401.vue'], resolve); }
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error_500',
    component: resolve => { require(['./views/error_page/500.vue'], resolve); }
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: resolve => { require(['./views/main_components/locking-page.vue'], resolve); }
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    component: Main,
    children: [
        { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: resolve => { require(['./views/home/home.vue'], resolve); } },
        { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: resolve => { require(['./views/own-space/own-space.vue'], resolve); } },
        { path: 'distribution-detail/:order_id', title: '配送详情', name: 'distribution-detail', component: resolve => { require(['./views/order/distribution-detail.vue'], resolve); } },
        { path: 'order/:order_id', title: '订单详情', name: 'order_info', component: resolve => { require(['./views/advanced-router/component/order-info.vue'], resolve); } },  // 用于展示动态路由
        { path: 'shopping', title: '购物详情', name: 'shopping', component: resolve => { require(['./views/advanced-router/component/shopping-info.vue'], resolve); } },  // 用于展示带参路由
        { path: 'message', title: '消息中心', name: 'message_index', component: resolve => { require(['./views/message/message.vue'], resolve); } },
        { path: 'buy', title: '抢单', name: 'buy', component: resolve => { require(['./views/equipment/buy.vue'], resolve); } },
        { path: 'pending', title: '待处理', name: 'pending',  component: resolve => { require(['./views/equipment/pending.vue'], resolve); } },
        { path: 'processed', title: '已处理', name: 'processed',  component: resolve => { require(['./views/equipment/processed.vue'], resolve); } },
        { path: 'release', title: '发布任务', name: 'release',  component: resolve => { require(['./views/equipment/release.vue'], resolve); } },
        { path: 'amap', title: '地图展示', name: 'amap',  component: resolve => { require(['./views/amap.vue'], resolve); } },
        { path: 'routine/add', title: '常规巡检报告录入', name: 'routineAdd', component: resolve => { require(['./views/monitor/routineAdd.vue'], resolve); } },
        { path: 'routine/details/:id', title: '常规巡检报告详情', name: 'routineDetails', component: resolve => { require(['./views/monitor/routineDetails.vue'], resolve); } },
        { path: 'transfer/add', title: '交接班巡检报告录入', name: 'transferAdd', component: resolve => { require(['./views/monitor/transferAdd.vue'], resolve); } },
        { path: 'transfer/details/:id', title: '交接班检报告详情', name: 'transferDetails', component: resolve => { require(['./views/monitor/transferDetails.vue'], resolve); } },
        { path: 'essential/details/:id', title: '详情', name: 'essentialDetails', component: resolve => { require(['./views/box/essentialDetails.vue'], resolve); } }
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/access',
        icon: 'key',
        name: 'access',
        title: '权限管理',
        component: Main,
        children: [
            { path: 'index', title: '权限管理', name: 'access_index', component: resolve => { require(['./views/access/access.vue'], resolve); } }
        ]
    },
    {
        path: '/order',
        icon: 'document-text',
        name: 'order',
        title: '配送管理',
        component: Main,
        children: [
            { path: 'requirement-order', title: '需求订单', name: 'requirement-order', icon: 'document-text', component: resolve => { require(['./views/order/requirement-order.vue'], resolve); } },
            { path: 'distribution-order', title: '配送订单', name: 'distribution-order', icon: 'document-text', component: resolve => { require(['./views/order/distribution-order.vue'], resolve); } },
            { path: 'history-order', title: '历史订单', name: 'history-order', icon: 'document-text', component: resolve => { require(['./views/order/history-order.vue'], resolve); } },
            { path: 'car-management', title: '槽车管理', name: 'car-management', icon: 'document-text', component: resolve => { require(['./views/order/car-management.vue'], resolve); } }
        ]
    },
    {
        path: '/equipment',
        icon: 'document-text',
        name: 'equipment',
        title: '设备管理',
        component: Main,
        children: [
            { path: 'contend-list', title: '抢单列表', name: 'contend-list', icon: 'document-text', component: resolve => { require(['./views/equipment/contend.vue'], resolve); } },
            { path: 'fault-deal', title: '故障处理', name: 'fault-deal', icon: 'document-text', component: resolve => { require(['./views/equipment/deal.vue'], resolve); } },
            { path: 'equip-message', title: '设备信息', name: 'quip-message', icon: 'document-text', component: resolve => { require(['./views/equipment/equip.vue'], resolve); } },
            { path: 'online-equip', title: '上线设备', name: 'online-equip', icon: 'document-text', component: resolve => { require(['./views/equipment/online.vue'], resolve); } },
            { path: 'patrol-record', title: '巡检记录', name: 'patrol-record', icon: 'document-text', component: resolve => { require(['./views/equipment/patrol.vue'], resolve); } },
            { path: 'patrol-setting', title: '巡检设置', name: 'patrol-setting', icon: 'document-text', component: resolve => { require(['./views/equipment/setting.vue'], resolve); } },
        ]
    },
    {
        path: '/system',
        icon: 'document-text',
        name: 'system',
        title: '系统管理',
        component: Main,
        children: [

            { path: 'authority-management', title: '权限管理', name: 'authority-management', icon: 'document-text', component: resolve => { require(['./views/system/authorityManagement.vue'], resolve); } },
            { path: 'user-behavior', title: '用户行为分析', name: 'user-behavior', icon: 'document-text', component: resolve => { require(['./views/system/behavior.vue'], resolve); } },
            { path: 'dictionary-management', title: '字典管理', name: 'dictionary-management', icon: 'document-text', component: resolve => { require(['./views/system/dictionaryManagement.vue'], resolve); } },
            { path: 'log-management', title: '日志管理', name: 'log-management', icon: 'document-text', component: resolve => { require(['./views/system/logManagement.vue'], resolve); } },
            { path: 'organization-management', title: '机构管理', name: 'organization-management', icon: 'document-text', component: resolve => { require(['./views/system/organizationManagement.vue'], resolve); } },
            { path: 'resource-management', title: '资源管理', name: 'resource-management', icon: 'document-text', component: resolve => { require(['./views/system/resourceManagement.vue'], resolve); } },
            { path: 'role-management', title: '角色管理', name: 'role-management', icon: 'document-text', component: resolve => { require(['./views/system/roleManagement.vue'], resolve); } },
            { path: 'station-management', title: '站点管理', name: 'station-management', icon: 'document-text', component: resolve => { require(['./views/system/stationManagement.vue'], resolve); } },
            { path: 'user-management', title: '用户管理', name: 'user-management', icon: 'document-text', component: resolve => { require(['./views/system/userManagement.vue'], resolve); } },
        ]
    },
    {
        path: '/statistics',
        icon: 'document-text',
        name: 'statistics',
        title: '统计分析',
        component: Main,
        children: [
            { path: 'benefit-forms', title: '效益分析报表', name: 'benefit-forms', icon: 'document-text', component: resolve => { require(['./views/statistics/Benefit.vue'], resolve); } },
            { path: 'change-statistics', title: '待更换设备统计', name: 'change-statistics', icon: 'document-text', component: resolve => { require(['./views/statistics/Change.vue'], resolve); } },
            { path: 'consume-statistics', title: '气站消耗统计', name: 'consume-statistics', icon: 'document-text', component: resolve => { require(['./views/statistics/Consume.vue'], resolve); } },
            { path: 'same-link', title: '同比环比', name: 'same-link', icon: 'document-text', component: resolve => { require(['./views/statistics/Contrast.vue'], resolve); } },
            { path: 'distribution-statistics', title: '站点分布统计', name: 'distribution-statistics', icon: 'document-text', component: resolve => { require(['./views/statistics/Distribution.vue'], resolve); } },
            { path: 'reserves-statistics', title: '气站储量统计', name: 'reserves-statistics', icon: 'document-text', component: resolve => { require(['./views/statistics/Reserves.vue'], resolve); } },
            { path: 'territory-compare', title: '地域对比', name: 'territory-compare', icon: 'document-text', component: resolve => { require(['./views/statistics/Territory.vue'], resolve); } },
            { path: 'thermodynamic-map', title: '经济效益热力图', name: 'thermodynamic-map', icon: 'document-text', component: resolve => { require(['./views/statistics/Thermodynamic.vue'], resolve); } },
            { path: 'warning-statistics', title: '站点预警统计', name: 'warning-statistics', icon: 'document-text', component: resolve => { require(['./views/statistics/Warning.vue'], resolve); } },
        ]
    },
    {
        path: '/monitor',
        icon: 'social-instagram',
        name: 'monitor',
        title: '实时监控',
        component: Main,
        children: [
            { path: 'real-data', title: '实时数据', name: 'real-data', icon: 'document-text', component: resolve => { require(['./views/monitor/real-data.vue'], resolve); } },
            { path: 'history-data', title: '历史数据', name: 'history-data', icon: 'document-text', component: resolve => { require(['./views/monitor/history-data.vue'], resolve); } },
            { path: 'data-statistics', title: '数据统计', name: 'data-statistics', icon: 'document-text', component: resolve => { require(['./views/monitor/data-statistics.vue'], resolve); } },
            { path: 'alarm-information', title: '报警信息', name: 'alarm-information', icon: 'document-text', component: resolve => { require(['./views/monitor/alarm-information.vue'], resolve); } },
            { path: 'vehicle-exhibition', title: '车辆展示', name: 'vehicle-exhibition', icon: 'document-text', component: resolve => { require(['./views/monitor/vehicle-exhibition.vue'], resolve); } },
            { path: 'video-monitor', title: '视频监控', name: 'video-monitor', icon: 'document-text', component: resolve => { require(['./views/monitor/video-monitor.vue'], resolve); } },
            { path: 'routine-report', title: '常规巡检报告', name: 'routine-report', icon: 'document-text', component: resolve => { require(['./views/monitor/routine.vue'], resolve); } },
            { path: 'transfer-report', title: '交接班巡检报告', name: 'transfer-report', icon: 'document-text', component: resolve => { require(['./views/monitor/transfer.vue'], resolve); } }
        ]
    },
    {
        path: '/lng',
        icon: 'person',
        name: 'lng',
        title: '我的LNG',
        component: Main,
        children: [
            { path: 'personalCenter', title: '个人中心', name: 'personalCenter', icon: 'document-text', component: resolve => { require(['./views/lng/personalCenter.vue'], resolve); } },
            { path: 'message', title: '消息推送', name: 'message', icon: 'document-text', component: resolve => { require(['./views/lng/message.vue'], resolve); } },
            { path: 'orderManagement', title: '订单管理', name: 'orderManagement', icon: 'document-text', component: resolve => { require(['./views/lng/orderManagement.vue'], resolve); } },
        ]
    },
    {
        path: '/box',
        icon: 'gear-b',
        name: 'box',
        title: 'LNG BOX',
        component: Main,
        children: [
            { path: 'essential', title: '基本信息', name: 'essential', icon: 'document-text', component: resolve => { require(['./views/box/essential.vue'], resolve); } },
        ]
    },
    {
        path: '/advanced-router',
        icon: 'ios-infinite',
        name: 'advanced-router',
        title: '高级路由',
        component: Main,
        children: [
            { path: 'mutative-router', title: '动态路由', name: 'mutative-router', icon: 'link', component: resolve => { require(['./views/advanced-router/mutative-router.vue'], resolve); } },
            { path: 'argument-page', title: '带参页面', name: 'argument-page', icon: 'android-send', component: resolve => { require(['./views/advanced-router/argument-page.vue'], resolve); } }
        ]
    },
    {
        path: '/error-page',
        icon: 'android-sad',
        title: '错误页面',
        name: 'errorpage',
        component: Main,
        children: [
            { path: 'index', title: '错误页面', name: 'errorpage_index', component: resolve => { require(['./views/error_page/error-page.vue'], resolve); } }
        ]
    }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    locking,
    ...appRouter,
    page500,
    page401,
    page404
];
